#pragma once
#include <BWAPI.h>
#include "Potential.h"
using namespace BWAPI;

// Keeps track of recent movements of a unit, producing a repulsive force to keep the unit from becoming stuck in a local minimum
class PheramoneTrail
{
  public:
    PheramoneTrail(Unit* unit,int maxLength,double strength);
    void setMaxLength(int maxLength);
    std::list<Potential*> getTrail();
    void update();

  private:
    std::list<Position> trail; // the potentials created by this trail, with the first being the newest
    Unit* unit; // unit leaving this trail
    unsigned int maxLength; // maximum number of frames before trail fades
    double strength; // magnitude of the potential from the trail when first created
    static const int width = 20; // The width of the potential field (small so that it has little impact on an active unit)
};
